﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ef
{
    class Program
    {
        static void Main(string[] args)
        {
            List<Perhaps> perhaps = new List<Perhaps>
            {
                new Perhaps(){name="张珊",wenke="FALSE",yuwen =127,shuxue=145,yingyu=122,zhonghe=289 },
                new Perhaps(){name="刘亮",wenke="TRUE",yuwen =103,shuxue=145,yingyu=122,zhonghe=250 },
                new Perhaps(){name="薛贵",wenke="TRUE",yuwen =136,shuxue=102,yingyu=89,zhonghe=189 },
                new Perhaps(){name="吴迪",wenke="TRUE",yuwen =126,shuxue=98,yingyu=140,zhonghe=238 }
            };
            var linquery=from p in perhaps
                         where p.wenke=="TRUE"
                         select p;
            foreach (var item in linquery)
            {
                Console.WriteLine("{0},语文{1}数学{2}英语{3}综合{4}",item.name,item.yuwen,item.shuxue ,item.yingyu ,item.zhonghe );
              
            }
             var avg = linquery.Average(p => p.yuwen + p.shuxue + p.yingyu + p.zhonghe);
                Console.WriteLine("平均分:"+avg);
          


        }
    }
}
